<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<jsp:include page="WEB-INF/incl/htmlHeader.jsp" />
<title>Welcome! | Cult Cinema Inc</title>
</head>
<body id="seatPlan">
	<jsp:include page="WEB-INF/incl/header.jsp" />
	<div id="pageheader">
		<div class="container">
			<h1>Seat Plan</h1>
		</div>
	</div>
	<div id="main" class="container">
		<div class="wrapper">
			<jsp:include page="WEB-INF/incl/messages.jsp" />
			<table class="data-table horizontal_table readonly"
				style="width: 100%">
				<tr>
					<th scope="col"><fmt:message key="house.houseName"
							bundle="${uitext}" />
					</th>
					<td><p>${requestScope.scheduleTO.houseName}</p>
					</td>
				</tr>
				<tr>
					<th scope="col"><fmt:message key="movie.name"
							bundle="${uitext}" />
					</th>
					<td><p>${requestScope.scheduleTO.movieName}</p>
					</td>
				</tr>
				<tr>
					<th scope="col"><fmt:message key="movie.category"
							bundle="${uitext}" />
					</th>
					<td><p>${requestScope.scheduleTO.movieCategory}</p>
					</td>
				</tr>
				<tr>
					<th scope="col"><fmt:message key="schedule.scheduleStart"
							bundle="${uitext}" />
					</th>
					<td><fmt:formatDate
							value="${requestScope.scheduleTO.scheduleStart}"
							pattern="dd/MM/yyyy hh:mmaaa" />
					</td>
				</tr>
				<tr>
					<th scope="col"><fmt:message key="schedule.price"
							bundle="${uitext}" />
					</th>
					<td>${requestScope.scheduleTO.price}</td>
				</tr>
			</table>
			<table class="seat_table">
				<tr>
					<td><span class="seat SEAT_STATUS_AVAILABLE"><fmt:message key="seat.status.seat_status_available" bundle="${uitext}" /></span></td>
					<td><span class="seat SEAT_STATUS_SOLD"><fmt:message key="seat.status.seat_status_sold" bundle="${uitext}" /></span></td>
					<td><span class="seat SEAT_STATUS_RESERVED"><fmt:message key="seat.status.seat_status_reserved" bundle="${uitext}" /></span></td>
					<td><span class="seat SEAT_STATUS_PROCESSING"><fmt:message key="seat.status.seat_status_processing" bundle="${uitext}" /></span></td>
				</tr>
			</table>
			
			<div class="seat_plan_content">
				<c:set value="true" var="firstRow" scope="page" />
				<table class="seat_table">
					<tr>
					<c:forEach var="seat" items="${requestScope.seatDetailList}">
						<c:if test="${lastRow ne seat.row and firstRow eq false}">
							</tr><tr>
						</c:if>
						<td>
							<c:if test="${seat.seatStatus eq 'SEAT_STATUS_AVAILABLE'}">
								<a href="seatPlan.do?seatDetailId=${seat.id}&amp;scheduleId=${requestScope.scheduleTO.id}"><span class="seat ${seat.seatStatus}">${seat.row}${seat.col}</span></a>
							</c:if>
							<c:if test="${seat.seatStatus ne 'SEAT_STATUS_AVAILABLE'}">
								<span class="seat ${seat.seatStatus}">${seat.row}${seat.col}</span>
							</c:if>
							<!-- debug: ${lastRow ne seat.row and firstRow eq false} -->
						</td>
						<c:set value="${seat.row}" var="lastRow" scope="page" />
						<c:set value="false" var="firstRow" scope="page" />
					</c:forEach>
					</tr>
				</table>
				<p class="screen">Screen</p>
			</div>
			<a href="payment.do?scheduleId=${requestScope.scheduleTO.id}"><div class="blue_btn large_btn"><fmt:message key="form.btn.confirm" bundle="${uitext}"/></div></a>
		</div>
	</div>
	<jsp:include page="WEB-INF/incl/footer.jsp" />
</body>
</html>